package swimv2gm.bl.domain;

import javax.persistence.*;

/**
 * Chiave primaria per Friendship.
 * 
 * @author Matteo Gallesio
 */
public class FriendshipPK implements java.io.Serializable {
	private static final long serialVersionUID = 1L;
	@OneToOne
	private User mittente;
	@OneToOne
	private User destinatario;

	public User getMittente() {
		return mittente;
	}

	public void setMittente(User mittente) {
		this.mittente = mittente;
	}

	public User getDestinatario() {
		return destinatario;
	}

	public void setDestinatario(User destinatario) {
		this.destinatario = destinatario;
	}

	@Override
	public boolean equals(Object o) {
		if (o == null || !(o instanceof FriendshipPK))
			return false;
		FriendshipPK apk = (FriendshipPK)o;
		return mittente == apk.mittente && destinatario == apk.destinatario;
	}

	@Override
	public int hashCode() {
		return (mittente.hashCode() + ":" + destinatario.hashCode()).hashCode();
	}
}